VERSION 5.00
Begin VB.Form FrmDangNhap 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Form1"
   ClientHeight    =   2085
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   5160
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2085
   ScaleWidth      =   5160
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton btnDangXuat 
      Caption         =   "Thoat"
      Height          =   375
      Left            =   3360
      TabIndex        =   5
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton btnDangNhap 
      Caption         =   "Dang nhap"
      Height          =   375
      Left            =   2040
      TabIndex        =   4
      Top             =   1440
      Width           =   1215
   End
   Begin VB.TextBox txtMatKhau 
      Height          =   375
      Left            =   1680
      TabIndex        =   2
      Top             =   840
      Width           =   2895
   End
   Begin VB.TextBox txtTenDangNhap 
      Height          =   375
      Left            =   1680
      TabIndex        =   0
      Top             =   360
      Width           =   2895
   End
   Begin VB.Label Label2 
      Caption         =   "Mat khau"
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   960
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "Ten dang nhap"
      Height          =   255
      Left            =   360
      TabIndex        =   1
      Top             =   480
      Width           =   1095
   End
End
Attribute VB_Name = "FrmDangNhap"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Event EVENTLogin(tendangnhap As String, matkhau As String)
Event EVENTThoat()

Public Function ValidateInput(ByRef errText As String) As Boolean
    ValidateInput = True
    If Trim(txtTenDangNhap.Text) = "" Then
        errText = "Ban chua nhap ten dang nhap"
        ValidateInput = False
        Exit Function
    End If
    If Trim(txtMatKhau.Text) = "" Then
        errText = "Ban chua nhap mat khau"
        ValidateInput = False
        Exit Function
    End If
End Function

Private Sub btnDangNhap_Click()
    Dim errTxt As String
    
    If Not ValidateInput(errTxt) Then
        MsgBox errTxt, vbCritical, "ThongBao"
        Exit Sub
    End If
    
    RaiseEvent EVENTLogin(Trim(txtTenDangNhap.Text), Trim(txtMatKhau.Text))
    Unload Me
End Sub

Private Sub btnDangXuat_Click()
    RaiseEvent EVENTThoat
    Unload Me
End Sub

Private Sub Form_Load()
    txtMatKhau.PasswordChar = "*"
End Sub
